package com.easipass.framework.eirframeworkcoredsl;

import java.util.List;

public class AppValidationException extends RuntimeException {

    private AppNode appNode;

    private List<AppValidationProblem> validationProblems;

    public AppValidationException(AppNode appNode, List<AppValidationProblem> validationProblems) {
        this.appNode = appNode;
        this.validationProblems = validationProblems;
    }

    public List<AppValidationProblem> getValidationProblems() {
        return validationProblems;
    }

    public AppNode getAppNode() {
        return appNode;
    }

    @Override
    public String getMessage() {
        StringBuilder s = new StringBuilder();
        s.append("Problems found when validating '").append(appNode.getAppDsl()).append("': ");
        s.append(validationProblems);
        return s.toString();
    }

}
